<script setup>
import { ref } from 'vue'
const clubSearchData = ref({
  communityNumber:'',
  communityName:'',
  societyMinister:''
})
const handlerSearch = () => {}
const handlerReset = () => {}
const tableData = [
  {
    clubId: '1',
    clubNumber: '001',
    clubName: '编程俱乐部',
    eventName: '初学者编程讲座',
    signUpTime: '2023-04-01 09:00',
    eventTime: '2023-04-08 14:00',
    participants: 30,
    eventAddress: '图书馆 101',
    eventCover: 'https://example.com/cover1.jpg',
    clubLeader: '张三',
    eventDescription: '适合初学者的编程讲座',
    reviewStatus: '已通过',
    createTime: '2023-03-30 10:00',
    isDeleted: false,
  },
  {
    clubId: '2',
    clubNumber: '002',
    clubName: '摄影俱乐部',
    eventName: '春季摄影大赛',
    signUpTime: '2023-03-01 09:00',
    eventTime: '2023-03-15 10:00',
    participants: 20,
    eventAddress: '校园广场',
    eventCover: 'https://example.com/cover2.jpg',
    clubLeader: '李四',
    eventDescription: '校园内的摄影比赛',
    reviewStatus: '待审核',
    createTime: '2023-02-28 11:00',
    isDeleted: false,
  },
  // 其他数据...
]

const handleClick = (row) => {
  console.log('点击了详情', row)
}

const handleSizeChange = (newSize) => {
  console.log('每页显示条数改变', newSize)
}

const handleCurrentChange = (newPage) => {
  console.log('当前页改变', newPage)
}
</script>

<template>
  <!-- 搜索 -->
  <div class="search_box">
    <el-card>
      <el-row :gutter="20">
        <el-col :span="6">
          <span>社团编号</span>
          <el-input v-model="clubSearchData.communityNumber" placeholder="请输入搜索社团编号"></el-input>
        </el-col>
        <el-col :span="6">
          <span>社团名称</span>
          <el-input v-model="clubSearchData.communityName" placeholder="请输入搜索社团名称"></el-input>
        </el-col>
        <el-col :span="6">
          <span>社团部长</span>
          <el-input v-model="clubSearchData.societyMinister" placeholder="请输入搜索社团部长"></el-input>
        </el-col>
        <el-col :span="6">
          <el-button type="primary" @click="handlerSearch">chuan</el-button>
          <el-button @click="handlerReset">重置</el-button>
        </el-col>
      </el-row>
    </el-card>
  </div>
  <!-- 列表区域 -->
  <div class="list_box">
    <!-- 表格 -->
    <el-card class="box-card">
      <el-table :data="tableData" border style="width: 100%" size="large">
        <el-table-column prop="clubId" label="社团活动ID" width="180" />
        <el-table-column prop="clubNumber" label="社团编号" width="180" />
        <el-table-column prop="clubName" label="社团名称" width="180" />
        <el-table-column prop="eventName" label="活动名称" width="180" />
        <el-table-column prop="signUpTime" label="报名时间" width="180" />
        <el-table-column prop="eventTime" label="活动时间" width="180" />
        <el-table-column prop="participants" label="参加人数" width="180" />
        <el-table-column prop="eventAddress" label="活动地址" width="180" />
        <el-table-column prop="eventCover" label="活动封面" width="180">
          <template #default="scope">
            <img :src="scope.row.eventCover" alt="活动封面" style="width: 100px; height: auto;" />
          </template>
        </el-table-column>
        <el-table-column prop="clubLeader" label="社团团长" width="180" />
        <el-table-column prop="eventDescription" label="活动简介" width="200" />
        <el-table-column prop="reviewStatus" label="审核状态" width="180" />
        <el-table-column prop="createTime" label="创建时间" width="180" />
        <el-table-column prop="isDeleted" label="逻辑删除" width="180">
          <template #default="scope">
            {{ scope.row.isDeleted ? '已删除' : '未删除' }}
          </template>
        </el-table-column>
        <el-table-column fixed="right" label="操作" min-width="120">
          <template #default="scope">
            <el-button link type="primary" size="small" @click="handleClick(scope.row)">
              详情
            </el-button>
            <el-button link type="primary" size="small">编辑</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination-block">
        <el-pagination
            size="large"
            v-model:current-page="currentPage4"
            v-model:page-size="pageSize4"
            :page-sizes="[100, 200, 300, 400]"
            layout="total, sizes, prev, pager, next, jumper"
            :total="400"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
        />
      </div>
    </el-card>
  </div>
</template>

<style scoped>
.box-card{
  position: relative;
  min-height: 78vh;
}
.list_box {
  margin: 20px 0;
}
.pagination-block{
  position: absolute;
  bottom: 3rem;
  left: 4rem;
  margin-top: 1rem;
}
.search_box {
  .el-col {
    display: flex;
    align-items: center;

    span {
      width: 120px;
      text-align: right;
      margin-right: 10px;
      text-wrap: nowrap;
    }
  }
}
</style>
